#include <xp/bas/time.h>
#include <xp/bas/stdio.h>

int xp_main ()
{
	xp_time_t t, t2;

	if (xp_gettime (&t) == -1) {
		xp_printf (XP_TEXT("cannot retrieve system time\n"));
		return -1;
	}

	xp_printf (XP_TEXT("%lld\n"), (long long)t);

	if (xp_settime (t - (60 * 60 * 1000)) == -1) {
		xp_printf (XP_TEXT("cannot set system time\n"));
		return -1;
	}

	if (xp_gettime (&t2) == -1) {
		xp_printf (XP_TEXT("cannot retrieve system time\n"));
		return -1;
	}

	xp_printf (XP_TEXT("%lld\n"), (long long)t2);

	xp_printf (XP_TEXT("wait for 10 seconds...\n"));
	xp_sleep (10000);

	if (xp_settime (t + 11000) == -1) {
		xp_printf (XP_TEXT("cannot restore system time\n"));
		return -1;
	}

	return 0;
}
